local zhanyuan = fk.CreateSkill {

  name = "joy__zhanyuan",

  tags = { Skill.Wake, },

}



zhanyuan:addEffect(fk.EventPhaseStart, {
  name = "joy__zhanyuan",
  anim_type = "special",
  events = {fk.EventPhaseStart,"fk.joy_mansi"},
  frequency = Skill.Wake,
  can_trigger = function(self, event, target, player, data)
    if event == fk.EventPhaseStart then
        return target == player and player:hasSkill(zhanyuan.name) and
      player.phase == Player.Start and
      player:usedSkillTimes(zhanyuan.name, Player.HistoryGame) == 0
    else
        return target == player and player:hasSkill(zhanyuan.name) and
      player.phase ~= Player.NotActive and
      player:usedSkillTimes(zhanyuan.name, Player.HistoryGame) == 0
    end
  end,
  can_wake = function(self, event, target, player, data)
    return player:getMark("@joy__mansi") > 7
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targets = table.map(room:getOtherPlayers(player), Util.IdMapper)
    if #targets == 0 then return end
    local to = room:askForChoosePlayers(player, targets, 1, 1, "#joy__zhanyuan-choose", zhanyuan.name, true)
    if #to > 0 then
      room:handleAddLoseSkills(player, "xili|-mansi", nil, true, false)
      room:handleAddLoseSkills(room:getPlayerById(to[1]), "xili", nil, true, false)
    end
  end,
})
--[[睿智北冰洋
zhanyuan:addEffect("fk.joy_mansi", {
  name = "joy__zhanyuan",
  anim_type = "special",
  events = {fk.EventPhaseStart,"fk.joy_mansi"},
  frequency = Skill.Wake,
  can_trigger = function(self, event, target, player, data)
    if event == fk.EventPhaseStart then
        return target == player and player:hasSkill(zhanyuan.name) and
      player.phase == Player.Start and
      player:usedSkillTimes(zhanyuan.name, Player.HistoryGame) == 0
    else
        return target == player and player:hasSkill(zhanyuan.name) and
      player.phase ~= Player.NotActive and
      player:usedSkillTimes(zhanyuan.name, Player.HistoryGame) == 0
    end
  end,
  can_wake = function(self, event, target, player, data)
    return player:getMark("@joy__mansi") > 7
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targets = table.map(room:getOtherPlayers(player), Util.IdMapper)
    if #targets == 0 then return end
    local to = room:askForChoosePlayers(player, targets, 1, 1, "#joy__zhanyuan-choose", zhanyuan.name, true)
    if #to > 0 then
      room:handleAddLoseSkills(player, "xili|-mansi", nil, true, false)
      room:handleAddLoseSkills(room:getPlayerById(to[1]), "xili", nil, true, false)
    end
  end,
})
--]]
return zhanyuan